package zhujie;

import java.lang.reflect.Method;
import java.util.Arrays;

public class Test {
    public static void main(String[] args) throws NoSuchMethodException {
        Class<BookStore> bookStoreClass = BookStore.class;
        boolean annotationPresent = bookStoreClass.isAnnotationPresent(Book.class);
        if (annotationPresent) {
            Book annotation = bookStoreClass.getAnnotation(Book.class);
            System.out.println(Arrays.toString(annotation.authors()));
            System.out.println(annotation.value());
            System.out.println(annotation.price());
        }

        Method method = bookStoreClass.getMethod("hh");

        if (method.isAnnotationPresent(Book.class)) {
            Book annotation = bookStoreClass.getAnnotation(Book.class);
            System.out.println(Arrays.toString(annotation.authors()));
            System.out.println(annotation.value());
            System.out.println(annotation.price());
        }
    }
}
